﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Coldairarrow.Business.Goods;
using Coldairarrow.Entity.DTO;
using Coldairarrow.Entity.Goods;
using Coldairarrow.IBusiness.Goods;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;

namespace Coldairarrow.Api.Controllers.WeChat
{
    [Route("/WeChat/[controller]/[action]")]
    public class WeChat_HomeController : BaseApiController
    {
        #region DI

        public WeChat_HomeController(IBTB_HomeBusiness bTB_HomeBus, IBTB_GoodsBusiness bTB_GoodsBusiness, IBTB_GoodsTypeBusiness bTB_GoodsTypeBusiness, IBTB_BannerBusiness bTB_BannerBus)
        {
            _bTB_HomeBus = bTB_HomeBus;
            _bTB_BannerBus = bTB_BannerBus;
            _bTB_GoodsBusiness = bTB_GoodsBusiness;
            _bTB_GoodsTypeBusiness = bTB_GoodsTypeBusiness;
        }

        IBTB_HomeBusiness _bTB_HomeBus;
        IBTB_BannerBusiness _bTB_BannerBus;
        IBTB_GoodsBusiness _bTB_GoodsBusiness;
        IBTB_GoodsTypeBusiness _bTB_GoodsTypeBusiness;
        #endregion
        /// <summary>
        /// 特惠列表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [NoCheckJWT]
        public async Task<List<BTB_GoodsDto>> GetPreferential()
        {
            return await _bTB_HomeBus.GetPreferential(4);
        }
        /// <summary>
        /// 首页热销
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [NoCheckJWT]
        public async Task<List<BTB_GoodsDto>> GetIsHont()
        {
            return await _bTB_HomeBus.GetIsHont(4);
        }
        /// <summary>
        /// 查询特惠所有的轮播图
        /// </summary>
        /// <returns></returns>
        [NoCheckJWT]
        [HttpPost]
        public async Task<List<BTB_Banner>> GePreferentialtData()
        {
            return await _bTB_BannerBus.GetData(2);
        }
        /// <summary>
        /// 查询二级分类
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [NoCheckJWT]
        public List<BTB_GoodsType> AllBackstage()
        {
            return _bTB_GoodsTypeBusiness.AllBackstage();
        }
        /// <summary>
        /// 二级查询所有商品
        /// </summary>
        /// <returns></returns>
        [NoCheckJWT]
        [HttpPost]
        public async Task<PageResult<BTB_GoodsDto>> GetWeChatListAsync(PageInput<GoodsDTO> input)
        {
            return await _bTB_HomeBus.GetWeChatListAsync(input);
        }
        /// <summary>
        /// 商品列表查询
        /// </summary>
        /// <returns></returns>
        [NoCheckJWT]
        [HttpPost]
        public async Task<PageResult<BTB_GoodsDto>> GetDataListAsync(PageInput<BTB_GoodsTypeDto> input)
        {
            return await _bTB_HomeBus.GetDataListAsync(input);
        }
    }
}

